package cn.gcjxsc.repository.salesaman;

import cn.gcjxsc.entity.salesman.RecommendMember;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

public interface RecommendMemberRepository extends JpaRepository<RecommendMember, Integer>, JpaSpecificationExecutor<RecommendMember> {
    /**
     * 查询业务员与会员的关系记录
     * @param salesmanId 业务员
     * @param memberId 会员id
     * @return
     */
    long countBySalesmanIdAndMemberId(Integer salesmanId, Integer memberId);

    RecommendMember findByMemberId(Integer memberId);

    RecommendMember findByMemberIdAndSalesmanMemberId(Integer memberId, Integer salesmanId);

    RecommendMember findByMemberIdAndSalesmanMemberIdAndStoreId(Integer memberId, Integer salesmanId, Integer storeId);

    RecommendMember findByMemberIdAndStoreId(Integer member, Integer storeId);
}
